package com.itcp.itelpicture.task;

import com.itcp.itelpicture.service.ILikeRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
@RequiredArgsConstructor
public class LikedTimesCheckTask {
    private static final List<String> OBJ_TYPES = List.of("POST", "PIC");
    private static final int MAX_OBJ_SIZE = 30;

    private final ILikeRecordService recordService;

    @Scheduled(fixedDelay = 10000)
    public void checkLikedTimes(){
        for (String objType : OBJ_TYPES) {
            recordService.readLikedTimes(objType, MAX_OBJ_SIZE);
        }
    }
}
